using System;

namespace Catastrophe.Common.AttributeEx
{
	public class ComDataAttribute : Attribute
	{
		public string Adr { get; set; } = "";


		public string AdrActual { get; set; }

		public CpuTypeEnum CpuType { get; set; } = CpuTypeEnum.Unknow;


		public DataTypeEnum DataType { get; set; } = DataTypeEnum.Unknow;


		public string Describe { get; set; } = "";


		public object DefaultValue { get; set; } = null;


		public OprTypeEnum OprType { get; set; } = OprTypeEnum.Unknow;


		public AllowOprEnum AllowOpr { get; set; } = AllowOprEnum.Unknow;


		public VarTypeEnum VarType { get; set; } = VarTypeEnum.Unknow;


		public SerialFlagEnum IsSerial { get; set; } = SerialFlagEnum.No;


		public byte BitIndex { get; set; } = byte.MaxValue;


		public ushort ByteCount { get; set; }

		public ushort DefineOprLen { get; set; }

		public string VarName { get; set; } = "";


		public string PropertyType { get; set; }

		public string Remark { get; set; } = "";


		public bool Ignore { get; set; }

		public bool ByteReverse { get; set; }

		public string ReverseFormat { get; set; } = "";


		public string WriteDataType { get; set; } = "";


		public ForceChangeHlByteEnum ForceChangeHlByte { get; set; } = ForceChangeHlByteEnum.Normal;


		public bool IgnoreMultiRead { get; set; }

		public bool IsRecord { get; set; }

		public string StringEncode { get; set; }

		public ComDataAttribute()
		{
		}

		public ComDataAttribute(string adr, string describe, OprTypeEnum oprType, AllowOprEnum allowOpr = AllowOprEnum.ReadAndWrite)
		{
			this.Adr = adr;
			this.CpuType = CpuTypeEnum.UnDefine;
			this.DataType = DataTypeEnum.PropertyType;
			this.OprType = oprType;
			this.AllowOpr = allowOpr;
			this.Describe = describe;
		}

		public ComDataAttribute(string adr, CpuTypeEnum cpuType, DataTypeEnum dataType, string describe, OprTypeEnum oprType, AllowOprEnum allowOpr = AllowOprEnum.ReadAndWrite)
		{
			this.Adr = adr;
			this.CpuType = cpuType;
			this.DataType = dataType;
			this.OprType = oprType;
			this.AllowOpr = allowOpr;
			this.Describe = describe;
		}
	}
}
